package com.xbts.system.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.Data;
import java.util.Objects;
import javax.validation.constraints.NotNull;
import com.xbts.common.annotation.Excel;
import com.xbts.common.utils.StringUtils;
import com.xbts.common.core.domain.BaseEntity;

/**
 * 数据盘对象 cn_data_volume
 *
 * @author xbts
 * @date 2023-08-04
 */
@Data
@ApiModel("数据盘对象")
@TableName("cn_data_volume")
public class CnDataVolume extends BaseEntity {

private static final long serialVersionUID=1L;

    /** 数据盘主键 */
    @TableId
    private Long dataVolumeId;

    /** 购物车/子订单表主键 */
    @Excel(name = "购物车/子订单表主键")
    @ApiModelProperty("购物车/子订单表主键")
    @NotEmpty(message = "购物车/子订单表主键不能为空")
    private Long orderId;

    /** 数据盘大小 单位：GB */
    @Excel(name = "数据盘大小 单位：GB")
    @ApiModelProperty("数据盘大小 单位：GB")
    @NotNull(message = "数据盘大小 单位：GB不能为空")
    private Integer dataVolumeSize;
    /** 数据盘磁盘类型 */
    @Excel(name = "数据盘磁盘类型")
    @ApiModelProperty("数据盘磁盘类型")
    @NotEmpty(message = "数据盘磁盘类型不能为空")
    private String dataVolumeType;

    public<T> QueryWrapper<T> queryWrapper(){
        QueryWrapper<T> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq(!Objects.isNull(dataVolumeSize),"data_volume_size",dataVolumeSize);
        queryWrapper.like(StringUtils.isNotEmpty(dataVolumeType),"data_volume_type",dataVolumeType);
        return queryWrapper;
    }
}